<template>
    <div class="box">
        <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="明细" name="first">
                <el-row type="flex" justify="space-between">
                    <el-col :span="24">
                        <div>
                            当前页共10项
                        </div>
                    </el-col>
                    <el-col :span="5">
                        <div class="flex-end">
                            <el-button type="primary" @click="onSubmit">新增</el-button>
                            <el-button type="primary" @click="onSubmit">删除</el-button>
                        </div>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24">
                        <div>
                            <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
                                @selection-change="handleSelectionChange">
                                <el-table-column type="selection" width="55">
                                </el-table-column>
                                <el-table-column label="序号" width="120">
                                    <template slot-scope="scope">{{ scope.row.date }}</template>
                                </el-table-column>
                                <el-table-column prop="name" label="所属网点" width="120">
                                </el-table-column>
                                <el-table-column prop="address" label="配置名称" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column prop="name" label="导出类型" width="120">
                                </el-table-column>
                                <el-table-column prop="name" label="导出对象名称" width="120">
                                </el-table-column>
                                <el-table-column prop="name" label="自动导出日期" width="120">
                                </el-table-column>
                                <el-table-column prop="name" label="创建日期" width="120">
                                </el-table-column>
                                <el-table-column prop="name" label="操作" width="120">
                                </el-table-column>
                            </el-table>
                        </div>
                    </el-col>

                </el-row>
                <div class="block" style="display: flex; justify-content: end;">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="currentPage4" :page-sizes="[100, 200, 300, 400]" :page-size="100"
                        layout="total, sizes, prev, pager, next, jumper" :total="400">
                    </el-pagination>
                </div>
            </el-tab-pane>
            <el-tab-pane label="汇总" name="second">
                <el-row type="flex" justify="space-between">
                    <el-col :span="15">
                        <div>
                            当前页共10项
                        </div>
                    </el-col>
                    <el-col :span="4">
                        <div class="flex-end">
                            <el-button type="primary" @click="onSubmit">导出</el-button>
                            <el-button type="primary" @click="onSubmit">数据说明</el-button>
                        </div>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24">
                        <div>
                            <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
                                @selection-change="handleSelectionChange">
                                <el-table-column type="selection" width="55">
                                </el-table-column>
                                <el-table-column label="序号" width="120">
                                    <template slot-scope="scope">{{ scope.row.date }}</template>
                                </el-table-column>
                                <el-table-column prop="name" label="所属网点" width="120">
                                </el-table-column>
                                <el-table-column prop="address" label="配置名称" show-overflow-tooltip>
                                </el-table-column>
                                <el-table-column prop="name" label="导出类型" width="120">
                                </el-table-column>
                                <el-table-column prop="name" label="导出对象名称" width="120">
                                </el-table-column>
                                <el-table-column prop="name" label="自动导出日期" width="120">
                                </el-table-column>
                                <el-table-column prop="name" label="创建日期" width="120">
                                </el-table-column>
                                <el-table-column prop="name" label="操作" width="120">
                                </el-table-column>
                            </el-table>
                        </div>
                    </el-col>

                </el-row>
                <div class="block" style="display: flex; justify-content: end;">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="currentPage4" :page-sizes="[100, 200, 300, 400]" :page-size="100"
                        layout="total, sizes, prev, pager, next, jumper" :total="400">
                    </el-pagination>
                </div>
            </el-tab-pane>
        </el-tabs>
    </div>
</template>

<script>
import * as echarts from "echarts";

export default {
    data() {
        return {
            activeName: 'first',

            form: {
                name: '',
                region: '',
                date1: '',
                date2: '',
                delivery: false,
                type: [],
                resource: '',
                currentPage4: 4,
                desc: '',

            },
            options: [{
                value: '选项1',
                label: '黄金糕'
            }, {
                value: '选项2',
                label: '双皮奶'
            }, {
                value: '选项3',
                label: '蚵仔煎'
            }, {
                value: '选项4',
                label: '龙须面'
            }, {
                value: '选项5',
                label: '北京烤鸭'
            }],
            value: '',
            tableData: [{
                date: '2016-05-03',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
            }, {
                date: '2016-05-02',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
            }, {
                date: '2016-05-04',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
            }, {
                date: '2016-05-01',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
            }, {
                date: '2016-05-08',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
            }, {
                date: '2016-05-06',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
            }, {
                date: '2016-05-07',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
            }],
        };
    },
    mounted() {
        this.initEcharts();
    },
    methods: {
        // 柱状图
        initEcharts() {
            var data = [23, 20, 17, 18, 9, 15, 6, 13, 18];
            const option = {
                aria: {
                    decal: {
                        enabled: true,
                        decal: {
                            show: true
                        }
                    }
                },
                legend: {
                    left: 'right',
                    data: ['收入', '做量']
                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'shadow'
                    }
                },

                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true,
                },

                xAxis: {
                    type: 'value',
                    boundaryGap: [0, 0.01],
                    axisLabel: {
                        color: "black",
                    }
                },
                yAxis: {
                    type: 'category',
                    data: [
                        '辽宁盘锦迎宾营业部',
                        '辽宁盘锦兴隆台营业部',
                        '辽宁盘锦古城子服务点',
                        '辽宁盘锦东郭镇营业部',
                        '辽宁盘锦新生服务点',
                        '辽宁盘锦曙光服务点',
                        '辽宁盘锦于楼服务点',
                        '辽宁盘锦新立镇营业部',
                    ],
                    axisLabel: {
                        color: "black",
                    },
                    axisTick: {
                        show: false
                    }
                },
                series: [
                    {
                        name: '主系列',
                        type: 'bar',
                        data: data,
                        barWidth: 30,
                        itemStyle: {
                            color: "#2087D0",
                            barBorderRadius: [10, 10, 10, 10],
                        },
                    },
                ]
            };
            const myChart = echarts.init(this.$refs.mychart); // 图标初始化
            myChart.setOption(option); // 渲染页面
            //随着屏幕大小调节图表
            window.addEventListener("resize", () => {
                myChart.resize();
            });
        },
    },

}
</script>

<style lang="scss" scoped>
.box {
    padding: 20px;
}

.flex {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

.header {
    padding-bottom: 20px;
    border-bottom: 1px solid #ccc;
}

.left {
    height: 600px;
    border: 1px solid #ccc;
    display: flex;
    justify-content: center;
    flex-flow: column;

   
}
.flex-end{
    display: flex;
    justify-content: flex-end;
    align-items: center;
}
.l-top {
        margin-top: 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;

        span {
            margin-left: 20px;
        }

        div {
            margin-right: 20px;
        }
    }

.right {
    height: 600px;
    display: flex;
    justify-content: center;
    flex-flow: column;
    border: 1px solid #ccc;
}

.el-row {
    margin-bottom: 20px;

    &:last-child {
        margin-bottom: 0;
    }
}

.el-col {
    border-radius: 4px;
}

.bg-purple-dark {
    background: #99a9bf;
}

.bg-purple {
    background: #d3dce6;
}

.bg-purple-light {
    background: #e5e9f2;
}

.grid-content {
    border-radius: 4px;
    min-height: 36px;
}

.row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
}
</style>